package com.qf.day08.book;

import java.util.Scanner;

public class Menu {
    BookInterface bookInter=new BookInterfaceImpl();
    public void show(){
        while (true){
            System.out.println("请选择功能:1.添加\t2.修改\t3.删除\t4.单个查询\t5.查询全部\t6.退出");
            Scanner scanner = new Scanner(System.in);
            int i = scanner.nextInt();
            switch (i){
                case 1:
                    System.out.println("请输入书名");
                    String bookName = scanner.next();
                    System.out.println("请输入位置");
                    String bookLocation = scanner.next();
                    Book book = new Book();
                    book.setBookName(bookName);
                    book.setLocation(bookLocation);
                    boolean flagAdd= bookInter.addBook(book);
                    if(flagAdd){
                        System.out.println("添加成功");
                    }else {
                        System.out.println("添加失败");
                    }
                    break;
                case 2:
                    System.out.println("请输入");
                    break;
                case 3:
                    System.out.println("请输入图书编号");
                    String bookDel=scanner.next();
                    boolean flagDel=bookInter.deleteBook(bookDel);
                    if(flagDel){
                        System.out.println("删除成功");
                    }else {
                        System.out.println("删除失败");
                    }
                    break;
                case 4:
                    System.out.println("请输入图书编号");
                    break;
                case 5:

                case 6:
                    System.out.println("拜拜");
                    return;
                default:
                    System.out.println("输入错误");
            }
        }
    }
}
